package com.compunit.composite.core.interfaces.cx;

import com.compunit.composite.core.interfaces.IExporter;

/**
 * <code>ICxExporter</code> defines the interface of
 * an utility exporter unit that provides the means
 * to export a component <code>cx</code> definition
 * file with the data added to the exporter instance.
 *
 * @author Yi Wang (Neakor)
 * @version Creation date: 11-07-2009 21:08 EST
 * @version Modified date: 11-21-2009 18:37 EST
 */
public interface ICxExporter extends IExporter {
	
	/**
	 * Add the given provider-consumer binding to the
	 * component definition. No duplicates are allowed.
	 * @param binding The <code>ICxBinding</code> to
	 * be added.
	 */
	public void addBinding(final ICxBinding binding);

	/**
	 * Add the given cx mapping definition to the
	 * component definition.
	 * <p>
	 * This method automatically excludes duplicates.
	 * @param mapping The <code>ICxMapping</code> data.
	 */
	public void addMapping(final ICxMapping mapping);

	/**
	 * Remove the given provider-consumer binding from
	 * the component definition.
	 * @param binding The <code>ICxBinding</code> to
	 * be removed.
	 */
	public void removeBinding(final ICxBinding binding);

	/**
	 * Remove the given cx mapping definition from the
	 * component definition interface mapping list.
	 * @param mapping The <code>ICxMapping</code> data.
	 */
	public void removeMapping(final ICxMapping mapping);

	/**
	 * Check if the exporter already contains the given
	 * binding.
	 * @param binding The <code>ICxBinding</code> to be
	 * checked.
	 * @return <code>true</code> if exporter already
	 * contains the given binding. <code>false</code>
	 * otherwise.
	 */
	public boolean containsBinding(final ICxBinding binding);
	
	/**
	 * Check if the exporter already contains the given
	 * mapping.
	 * @param mapping The <code>ICxMapping</code> to be
	 * checked.
	 * @return <code>true</code> if exporter already
	 * contains the given mapping. <code>false</code>
	 * otherwise.
	 */
	public boolean containsMapping(final ICxMapping mapping);
	
	/**
	 * Set the activation order of the component classes.
	 * @param units The <code>ICxUnit</code> array of units
	 * of components need to activated. The array order
	 * determines activation order of the components.
	 */
	public void setActivation(final ICxUnit[] units);
	
	/**
	 * Set the name of this component.
	 * @param name The <code>String</code> name.
	 */
	public void setName(final String name);
	
	/**
	 * Retrieve the component name.
	 * @return The <code>String</code> name.
	 */
	public String getName();
}
